﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
namespace BookVoting
{
    public class count
    {
        public static int readCount(string path)
        {
            int rCount = 0;
            StreamReader streamread = File.OpenText(path);
            if(streamread.Peek()!=-1)
            {
                rCount = int.Parse(streamread.ReadLine());
            }
            streamread.Close();
            return rCount;
        }
        public static void addCount(string path)
        {
            int rCount = readCount(path);
            rCount++;
            //写入文件
            StreamWriter streamWriter = new StreamWriter(path, false);
            streamWriter.WriteLine(rCount);
            streamWriter.Close();
        }
    }
}